package com.jt.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jt.pojo.Item;
import com.jt.pojo.ItemDesc;
import com.jt.service.ItemService;
@RestController
@RequestMapping("/web/item")
public class WebItemController {
	@Autowired
	private ItemService itemService;
	/**
	 * 访问的url规则:
	 * 	1.请求协议   http/https/udp/tcp
	 * 	2.请求主机的地址   域名/IP地址
	 * 	3.请求的端口号       默认 80 8080/8091
	 * 	4.业务名称
	 * 	5.方法名称
	 * 	6.如果有参数可以拼接
	 * 
	 * 从前台向后台发起请求:
	 * 	http://manage.jt.com:80/web/item/findItemById/562379
	 *  http://manage.jt.com:80/web/item/findItemById?id=562379
	 */

	@RequestMapping("/findItemById/{itemId}")
	public Item findItemById(@PathVariable Long itemId) {

		return itemService.findItemById(itemId);
	}
	/**
	 * 根据商品Id号动态查询商品详情信息
	 * http://manage.jt.com/web/item/findItemDescById/562379
	 */
	
	@RequestMapping("/findItemDescById/{itemId}")
	public ItemDesc findItemDescById(@PathVariable Long itemId) {
		
		return itemService.findItemDescById(itemId);
	}

}
